package org.dong.service.Impl;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.dong.Mapper.OrderMapper;
import org.dong.Tool.ApplicationUtil;
import org.dong.Tool.MyBatisUtil;
import org.dong.pojo.Order;
import org.dong.pojo.qo.OrderQo;
import org.dong.service.OrderService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Component("orderService")
@Transactional(rollbackFor = Exception.class)
public class OrderServiceImpl implements OrderService {

    @Resource
    OrderMapper orderMapper;
    @Override
    public Integer addOrder(Order order) {

        return orderMapper.addOrder(order);
    }

    @Override
    public List<OrderQo> getOrderList(String sDate,String eDate,String sName,String sCardId,String sMeal,int page) {
        return orderMapper.getOrderList(sDate,eDate,sName,sCardId,sMeal,page);
    }

    @Override
    public Integer updateOrder(int id, String codeUrl, Integer status) {

        return orderMapper.updateOrder(id, codeUrl, status);
    }

    @Override
    public Order getOrderInfo(int id) {
        return orderMapper.getOrderInfo(id);
    }

    @Override
    public Integer getOrderCount(String sDate, String eDate, String sName, String sCardId, String sMeal) {
        return orderMapper.getOrderCount(sDate, eDate, sName, sCardId, sMeal);
    }
}
